//
//  DataSummaryNaviCtrl.swift
//  TimeBoat
//
//  Created by bo wang on 2022/8/24.
//  Copyright © 2022 Time Boat. All rights reserved.
//

import UIKit

@objc class DataSummaryNaviCtrl: AppBaseNaviController {
    
    private lazy var instructionsView: InstructionsTipsView = {
        let v = R.nib.instructionsTipsView(owner: nil)!
        v.frame = UIScreen.main.bounds
        return v
    }()
    
    @objc static func create() -> DataSummaryNaviCtrl {
        return R.storyboard.charts.dataSummaryNaviCtrl()!
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        if (AccountManager.shareAccount().needPromptAgreement()) {
            let dialog = HoDialogView(dialogView: instructionsView, animationType: .MiddleShow)
            dialog?.show(nil)
            
            instructionsView.agreeBlock = { [self] in
                AccountManager.shareAccount().clearPromptAgreement()
                
                dialog?.dismiss()
                self.perform(#selector(showtips), with: nil, afterDelay: 1)
            }
            
            instructionsView.disagreeBlock = {
                dialog?.dismiss()
                exit(0)
            }
        }
        
        tabBarItem.title = "数据"
    }
    
    @objc func showtips(){
        if !APP.tuic{
            let vc = TipsViewController()
            self.topViewController!.present(vc, animated: false)
        }
    }
}
